<?php

/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/**
 * This file contains rules for inflection in the English language.
 *
 * PHP version 5
 *
 * This file is part of PEAR::PDORM - A database object relational management
 * layer for PHP 5 built using PDO. PHP version 5.1+ is recommended.
 *
 * PEAR::PDORM is free software: you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation, either version 3 of the License, or (at your option)
 * any later version.
 *
 * PEAR::PDORM is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with PEAR::PDORM. If not, see <http://www.gnu.org/licenses/>.
 *
 * @package     PDORM
 * @category    Object-relational Management
 * @author      Michael J. I. Jackson <mjijackson@gmail.com>
 * @copyright   2007 Michael J. I. Jackson
 * @license     http://www.gnu.org/licenses/lgpl-3.0.txt GNU LGPL 3.0
 * @version     SVN: $Id: en.php 37 2007-12-10 15:48:18Z mjijackson $
 * @link        http://pear.php.net/packages/PDORM
 */

/**
 * Plural word rules. Contains rules for converting nouns from singular to
 * plural form. Each rule is made up of a regular expression and its replacement
 * should it match. The last rule must be a catch-all.
 *
 * Note: Order here is important
 */
PDORM_Inflector::addPlural(array(
    '/(matr|vert|ind)(ix|ex)$/i'    => '\1ices',    // matrix, vertex, index
    '/(quiz)$/i'                    => '\1zes',     // quiz
    '/(ss|sh|ch|x|z)$/i'            => '\1es',      // sibilant rule (no ending e)
    '/([^aeiou])o$/i'               => '\1oes',     // -oes rule
    '/([^aeiou]|qu)y$/i'            => '\1ies',     // -ies rule
    '/sis$/i'                       => 'ses',       // synopsis, diagnosis
    '/(m|l)ouse$/i'                 => '\1ice',     // mouse, louse
    '/(t|i)um$/i'                   => '\1a',       // datum, medium
    '/([li])fe?$/i'                 => '\1ves',     // knife, life, shelf
    '/(octop|vir)us$/i'             => '\1i',       // octopus, virus
    '/(ax|test)is$/i'               => '\1es',      // axis, testis
    '/s$/'                          => 's',         // all other s
    '/$/'                           => 's'          // catch all
));

/**
 * Words that don't follow any pluralization rules.
 */
PDORM_Inflector::addIrregular(array(
    'man'       => 'men',
    'person'    => 'people',
    'child'     => 'children'
));

/**
 * Words whose singular and plural forms are the same.
 */
PDORM_Inflector::addUncountable(array(
    'news',
    'money',
    'equipment',
    'information',
    'rice',
    'species',
    'series',
    'fish',
    'sheep',
    'moose'
));

?>
